﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VersionManage.Logic
{
      
      //URL验证
    //[RequestParamter(Method = HttpMethod.Put, Url = "", ContentType = "application/octet-stream", Headers = new string[] { "x-oss-meta-author: aliy" })]
    //Headers验证
    [RequestParamter(Method = HttpMethod.Put, Url = "", ContentType = "application/octet-stream")]
    public class OssPutRequest
    {

        private string ossPath;
        /// <summary>
        /// 相对的文件名 如:/oss/9432/123.data
        /// </summary>
        [RequestProperty(Type = PropertyType.Url)]
        public string OssPath
        {
            get { return ossPath; }
            set
            {
                if (!string.IsNullOrEmpty(value) && value[0] != '/')
                    ossPath = "/" + value;
                else
                    ossPath = value;
            }
        }

        /// <summary>
        /// 过期时间
        /// </summary>
        //public string Expires { get { return DateTime.UtcNow.AddYears(3).ToString("R"); } }

        //public string Date { get { return DateTime.Now.ToString("R"); } }
        /// <summary>
        /// 文件名 如:123.data
        /// </summary>
        //[HIHS.Net.Http.RequestProperty(Name = "Content-Disposition")]
        //public string Content_Disposition
        //{
        //    get
        //    {
        //        return downName + OssPath.Substring(OssPath.LastIndexOf('/'));
        //    }
        //}


        //[HIHS.Net.Http.RequestProperty(Name = "x-oss-server-side-encryption")]
        //public string Sideencryption
        //{
        //    get
        //    {
        //        return "AES256";
        //    }
        //}
        /// <summary>
        ///  文件数据
        /// </summary>
        [VersionManage.Logic.RequestProperty(Type = PropertyType.Body)]
        public byte[] Data { get; set; }

        //private DateTime date = DateTime.UtcNow;
        //public string Date { get { return date.ToString("R"); } }

        //[HIHS.Net.Http.RequestProperty(Type = PropertyType.Head, Name = "x-oss-object-acl")]
        //public string x_oss_object_acl { get { return "public-read-write"; } }
        /// <summary>
        /// 验证信息
        /// </summary>
        public string Authorization { get; set; }


    }


    [RequestParamter(Url = "aliyun/getCdnUrl", Remarks = "从Focus服务器请求",Method=HttpMethod.Get)]
    public class OssCdnRequest
    {
    }

    /// <summary>
    /// 
    /// </summary>
    //[RequestParamter(Url = "aliyun/getSign", Remarks = "从Focus服务器请求", Method = HttpMethod.Get)]
    [RequestParamter(Url = "aliyun/getSignUrl", Remarks = "从Focus服务器请求", Method = HttpMethod.Get)]
    public class OssSignRequest
    {
        public string objectName { get; set; }
    }

    /// <summary>
    /// 查询文件属性
    /// </summary>
    [RequestParamter(Url = "", Method = HttpMethod.Head)]
    public class OssHeadReques
    {

        private string ossPath;
        /// <summary>
        /// 相对的文件名 如:oss/9432/123.data
        /// </summary>
        [RequestProperty(Type = PropertyType.Url)]
        public string OssPath
        {
            get { return ossPath; }
            set
            {
                if (!string.IsNullOrEmpty(value) && value[0] != '/')
                    ossPath = "/" + value;
                else
                    ossPath = value;
            }
        }

        /// <summary>
        /// 验证信息
        /// </summary>
        //public string Authorization { get; set; }
    }

    [RequestParamter(Url = "", Method = HttpMethod.Get)]
    public class OssDownLoadRequest
    {
        /// <summary>
        /// 验证信息
        /// </summary>
        //[HIHS.Net.Http.RequestProperty(Type = PropertyType.Head)]
        //public string Authorization { get; set; }

        private string ossPath;
        /// <summary>
        /// 相对的文件名 如:oss/9432/123.data
        /// </summary>
        [RequestProperty(Type = PropertyType.Url)]
        public string OssPath
        {
            get { return ossPath; }
            set
            {
                if (!string.IsNullOrEmpty(value) && value[0] != '/')
                    ossPath = "/" + value;
                else
                    ossPath = value;
            }
        }

        //[HIHS.Net.Http.RequestProperty(Type = PropertyType.Head)]
        //public string Range { get; set; }


    }

    [RequestParamter(Url = "", Method = HttpMethod.Delete,ContentType="")]
    public class OssDelete
    { }


    [RequestParamter(Url = "aliyun/getOssAccountInfo", Method = HttpMethod.Get)]
    public class GetOssAccountInfoRequest
    { 
    
    }
}
